
import {simpleServer} from '@/tools/servers'

/**
 * 订单
 */
export class OrderService {
    // 分页查询列表
    static findOrders (pageDTO) {
        var httpMethod = 'POST';
        var body = simpleServer.getArgs(this.findOrders,arguments,'POST');
        return simpleServer.connection(httpMethod, '/simple/order/Order/findOrders', body);
    }


    //根据订单Id查询订单
    static findOrder (orderId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findOrder ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/findOrder',body);
    }

    //为了编辑,根据订单Id查询订单
    static findOrderForEdit(orderId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findOrderForEdit ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/findOrderForEdit',body);
    }

    //为了查看,根据订单Id查询订单，所有外键字段的名称都已加载
    static findOrderForView(orderId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findOrderForView ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/findOrderForView',body);
    }

    //创建新的订单
    static createOrder() {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.createOrder,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/createOrder',body);
    }

    //保存订单
    static saveOrder(order) {
        var httpMethod = 'POST';
        var body = simpleServer.getArgs(this.saveOrder,arguments,'POST');
        return simpleServer.connection(httpMethod, '/simple/order/Order/saveOrder', body);
    }

    //编辑订单
    static updateOrder (order) {
        var httpMethod = 'POST';
        var body = simpleServer.getArgs(this.updateOrder,arguments,'POST');
        return simpleServer.connection(httpMethod, '/simple/order/Order/updateOrder', body);
    }

    //根据订单Id删除订单
    static deleteOrder (orderId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.deleteOrder,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/deleteOrder',body);
    }

    //为了查看,根据订单Id查询订单，只加载ID 和 名称
    static findOrdersWithIdNameById(orderId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findOrdersWithIdNameById ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/findOrdersWithIdNameById',body);
    }

    //为了查看,根据订单 名称 查询订单，只加载ID 和 名称
    static findOrdersWithIdNameByName(orderName) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findOrdersWithIdNameByName ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/order/Order/findOrdersWithIdNameByName',body);
    }


}
